翻訳と辞書 |
Expression-oriented programming language : ウィキペディア英語版 | Expression-oriented programming language An expression-oriented programming language is a programming language where every (or nearly every) construction is an expression and thus yields a value. The typical exceptions are macro definitions, preprocessor commands, and declarations, which expression-oriented languages often treat as statements rather than expressions. Some expression-oriented languages introduce a void return type to be yielded by expressions that merely cause side-effects. ALGOL 68 and Lisp are examples of expression-oriented languages. Pascal is not an expression-oriented language. All functional programming languages are expression-oriented. ==Criticism==
Critics, including language designers,〔(Java Code Conventions "10.4 Variable Assignments" )〕 blame expression-orientation for an entire class of programming mistake wherein a programmer introduces an assignment expression where they meant to test for equality. For example, the designers of Ada and Java were so worried about this type of mistake, they restricted control expressions to those that evaluate strictly to the boolean data type.〔(Java Language Specification "14.9 The if Statement" )〕〔(Introducing Ada )〕 The designers of Python had similar worries but took the alternative strategy of implementing assignment as a statement rather than an expression, thus prohibiting assignment from nesting inside of any other statement or expression.〔(The Python Language Reference "6.2. Assignment statements" )〕 However, notation provokes such errors, not semantics. From the perspective of expression-orientation, the choice of assignment notation made by C-style languages, the equals sign, = , can be considered a poor choice due to the equals sign's similarity to, and hazardously small typing distance〔In fact, considering the automatic repetition feature of typical computer keyboards, the minimum string distance between = and == is effectively zero, the ''worst possible'' collision.〕 from the notation C-style languages choose for the equality operator, == , make it an occasion for error. The expression-ness of assignment is not the root cause. Other language families make different notational choices for assignment that do not have this problem, such as ''variable'' ← ''expression'' in APL, ''variable'' <- ''expression'' in OCaml, S, and R, ''variable'' := ''expression'' in ALGOL 68 and Standard ML, or (setq ''variable'' ''expression'') in Lisp and Scheme. Furthermore, many expression-oriented languages are also functional languages. In these languages, assignment is either rare, or, in the case of purely functional languages, impossible.
抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Expression-oriented programming language」の詳細全文を読む
スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース |
Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.
|
|